package org.mclll.xwangplugin.questTracking.gui;

import org.mclll.xwangplugin.questTracking.listener.QuestListener;

import java.io.File;
import java.io.FileWriter;

/**
 * @author: geduo
 * @date: 2023/10/16 13:09
 */
public class QuestTrackingMenuPool {
    private static final String NEW_SHOP_FORMAT = "ShopName: questTracking\n" +
            "DisplayName: '§6任务追踪'\n" +
            "shop:\n" +
            "  back:\n" +
            "    MenuItem:\n" +
            "    - name:&a◆ 返回 - \n" +
            "    - 'lore:&7点击返回主菜单'\n" +
            "    - amount:1\n" +
            "    - type:ARROW\n" +
            "    RewardType: shop\n" +
            "    Reward: Menu\n" +
            "    PriceType: NOTHING\n" +
            "    Message: ''\n" +
            "    ExtraPermission: ''\n" +
            "    InventoryLocation: 27";
    public static void init(File dataFolder) {
        if (!dataFolder.exists()) {
            dataFolder.mkdirs();
        }
        File file = new File(dataFolder, QuestListener.SCOREBOARD_NAME + ".yml");
        if (!file.exists()) {
            try (FileWriter writer = new FileWriter(file)) {
                String content = NEW_SHOP_FORMAT;
                writer.write(content);
            } catch (Exception ignore) {
            }
        }
    }
}
